import 'package:flutter/material.dart';

void main() {
  // 1.运行应用程序
  runApp(const MaterialApp(home: Main()));
}

class Main extends StatelessWidget {
  const Main({super.key});

  @override
  Widget build(BuildContext context) {
    // 2.构建应用程序界面
    return Scaffold(
      appBar: AppBar(
        title: const Text(
          'ListView---1.基础用法',
          style: TextStyle(color: Colors.white),
        ),
        backgroundColor: Colors.black,
      ),
      // 中间内容
      body: ListView(
        scrollDirection: Axis.vertical,//纵向
        // scrollDirection: Axis.horizontal,//横向
        // reverse: true,//反向（意思就是倒序排列）
        // physics: const NeverScrollableScrollPhysics(),// 超出边界不能滚动
        children: [
          Container(
            height: 100,
            color: Colors.red,
            child: const Text('子元素1'),
          ),
          Container(
            height: 200,
            color: const Color.fromARGB(255, 54, 244, 95),
            child: const Text('子元素2'),
          ),
          Container(
            height: 300,
            color: const Color.fromARGB(255, 133, 54, 244),
            child: const Text('子元素3'),
          ),
          Container(
            height: 400,
            color: const Color.fromARGB(255, 244, 54, 193),
            child: const Text('子元素4'),
          ),
          Container(
            height: 500,
            color: const Color.fromARGB(255, 8, 116, 232),
            child: const Text('子元素5'),
          ),
          Container(
            height: 600,
            color: const Color.fromARGB(255, 232, 107, 5),
            child: const Text('子元素6'),
          ),

        ],

      ),
    );
  }
}
